home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / falcon / programm.ing / nt_dsp1.lzh / NT_DSP1.MSA / FLOAT / FPMPY.ASM < prev    next >
Assembly Source File  |  1989-01-24  |  2KB  |  78 lines

  1. ;
  2. ; This program originally available on the Motorola DSP bulletin board.
  3. ; It is provided under a DISCLAIMER OF WARRANTY available from
  4. ; Motorola DSP Operation, 6501 Wm. Cannon Drive W., Austin, Tx., 78735.
  5. ; Last Update 5 Oct 87   Version 2.0
  6. ;
  7. fpmpy   ident   2,0
  8. ;
  9. ; MOTOROLA DSP56000/1 FPLIB - VERSION 2
  10. ;
  11. ; FPMPY - FLOATING POINT MULTIPLICATION SUBROUTINE
  12. ;
  13. ; Entry points: fmpy_xy R = X * Y
  14. ;               fmpy_xa R = X * A
  15. ;
  16. ;       m = 24 bit mantissa (two's complement, normalized fraction)
  17. ;
  18. ;       e = 14 bit exponent (unsigned integer, biased by +8191)
  19. ;
  20. ; Input variables:
  21. ;
  22. ;   X   x1 = mx  (normalized)
  23. ;       x0 = ex
  24. ;
  25. ;   Y   y1 = my  (normalized)
  26. ;       y0 = ey
  27. ;
  28. ;   A   a2 = sign extension of ma
  29. ;       a1 = ma  (normalized)
  30. ;       a0 = zero
  31. ;
  32. ;       b2 = sign extension of ea (always zero)
  33. ;       b1 = ea
  34. ;       b0 = zero
  35. ;
  36. ; Output variables:
  37. ;
  38. ;   R   a2 = sign extension of mr
  39. ;       a1 = mr  (normalized)
  40. ;       a0 = zero
  41. ;
  42. ;       b2 = sign extension of er (always zero)
  43. ;       b1 = er
  44. ;       b0 = zero
  45. ;
  46. ; Error conditions:     Set CCR L=1 if floating point overflow.  Result
  47. ;                       is set to the maximum floating point value of the
  48. ;                       correct sign.  The CCR L bit remains set until
  49. ;                       cleared by the user.
  50. ;
  51. ;                       Set CCR L=1 if floating point underflow.  Result
  52. ;                       is set to floating point zero.  The CCR L bit
  53. ;                       remains set until cleared by the user.
  54. ;
  55. ; Assumes n0, m0, shift constant table and scaling modes
  56. ; initialized by previous call to the subroutine "fpinit".
  57. ;                                       
  58. ; Alters Data ALU Registers
  59. ;       a2      a1      a0      a
  60. ;       b2      b1      b0      b
  61. ;       y1
  62. ;
  63. ; Alters Address Registers
  64. ;       r0
  65. ;
  66. ; Alters Program Control Registers
  67. ;       pc      sr
  68. ;
  69. ; Uses 0 locations on System Stack
  70. ;
  71. ;
  72. fmpy_xy tfr     y0,b    y1,a            ;get ey, my
  73. fmpy_xa add     x0,b    fp_space:fp_ebias,x0    ;er' = ex + ea,get ebias
  74.         sub     x0,b    a,y1            ;subtract ebias from er',get ma
  75.         mpy     x1,y1,a         b,r0    ;mr = mx * ma, get er'
  76.         jmp     norm1                   ;normalize and check result
  77.